package com.htgd.gardenexpo.service.impl;

import com.htgd.gardenexpo.entity.GeConImpressionFeedback;
import com.htgd.gardenexpo.dao.GeConImpressionFeedbackDao;
import com.htgd.gardenexpo.service.GeConImpressionFeedbackService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * (GeConImpressionFeedback)表服务实现类
 *
 * @author makejava
 * @since 2021-06-08 15:18:31
 */
@Service("geConImpressionFeedbackService")
public class GeConImpressionFeedbackServiceImpl implements GeConImpressionFeedbackService {
    @Resource
    private GeConImpressionFeedbackDao geConImpressionFeedbackDao;

    /**
     * 通过ID查询单条数据
     *
     * @param 主键
     * @return 实例对象
     */
    @Override
    public GeConImpressionFeedback queryById() {
        return this.geConImpressionFeedbackDao.queryById();
    }

    /**
     * 查询多条数据
     *
     * @param offset 查询起始位置
     * @param limit  查询条数
     * @return 对象列表
     */
    @Override
    public List<GeConImpressionFeedback> queryAllByLimit(int offset, int limit) {
        return this.geConImpressionFeedbackDao.queryAllByLimit(offset, limit);
    }

    @Override
    public List<GeConImpressionFeedback> getinfoByImpressionId(int id) {
        return this.geConImpressionFeedbackDao.getinfoByImpressionId(id);
    }

    /**
     * 新增数据
     *
     * @param geConImpressionFeedback 实例对象
     * @return 实例对象
     */
    @Override
    public GeConImpressionFeedback insert(GeConImpressionFeedback geConImpressionFeedback) {
        this.geConImpressionFeedbackDao.insert(geConImpressionFeedback);
        return geConImpressionFeedback;
    }

    /**
     * 修改数据
     *
     * @param geConImpressionFeedback 实例对象
     * @return 实例对象
     */
    @Override
    public GeConImpressionFeedback update(GeConImpressionFeedback geConImpressionFeedback) {
        this.geConImpressionFeedbackDao.update(geConImpressionFeedback);
        return this.queryById();
    }

    /**
     * 通过主键删除数据
     *
     * @param 主键
     * @return 是否成功
     */
    @Override
    public boolean deleteById() {
        return this.geConImpressionFeedbackDao.deleteById() > 0;
    }
    @Override
    public boolean deleteByImpressionId(int id) {
        return this.geConImpressionFeedbackDao.deleteByImpressionId(id) > 0;
    }
}
